Nonlinear systems, such as those related to flowmeter harmonics, tend to distort signals. For example, if an input signal has strong frequency content at ω, then harmonic distortion produces an output signal with content at ω, 2ω, 3ω, etc. Related to this is the phenomenon of intermodulation (IM) distortion. IM distortion is seen when there are at least two input tones. In this case, the nonlinear system produces outputs not only at the harmonic frequencies, but also at linear combinations (e.g. sum and difference) of the input tones. These two phenomena are not mutually exclusive, and any nonlinear system that produces harmonic distortion for a single tone will produce IM distortion for multiple tones. The harmonic tones are actually a subset of the IM distortion tones.
By way of example, a velocity transducer, such as a voice coil transducer suitable for a flowmeter, may have an output described as:y(t)=k{dot over (x)}(t)  (1)
The gain, k, is usually treated as a constant (gain is also known as the BL coefficient). In the case of voice coil transducers, due to the varying engagement of the permanent magnet with respect to the coil, the transducer gain is actually a function of position, where transducer strength drops as the magnet moves away from the coil's center. An example mathematical model that describes this behavior is:k(x)=1−x2  (2)
For this transducer model to be accurate, the transducer's position must be restricted to a particular range (in this case, |x|≤1). To observe the effects of IM distortion, an example case where the input to the system is two pure frequencies may be described as:x(t)=A1 cos(ω1t)+A2 cos(Ω2t)  (3)
Substituting equations (3) and (2) into (1), the output may be computed:y(t)={dot over (x)}(t)(1−x2(t))=[−A1w1 sin(ω1t)−A2ω2 sin(ω2t)][1−(A1 cos(ω1t)+A2 cos(ω2t))2]  (4)
Expression (4) can be simplified by expanding the products, and then repeatedly applying the trigonometric identities for products of sines and cosines, for example:cos θ cos ϕ=½[cos(θ−ϕ)+cos(θ+ϕ)]cos θ sin ϕ=½[sin(θ+ϕ)−sin(θ−ϕ)]sin θ sin ϕ=½[cos(θ−ϕ)−cos(θ+ϕ)]  (5)
Expression (5) may be further simplified to:
                                          [                          -                                                ω                  1                                (                                                      A                    1                                    +                                                            A                      1                      3                                        4                                    +                                                                                    A                        1                                            ⁢                                              A                        2                        2                                                              2                                                  )                                      ]                    ⁢                      sin            ⁡                          (                                                ω                  1                                ⁢                t                            )                                      +                                                                       [                                  -                                                            ω                      2                                        (                                                                  A                        2                                            +                                                                        A                          2                          3                                                4                                            +                                                                                                    A                            1                            2                                                    ⁢                                                      A                            2                                                                          2                                                              )                                                  ]                            ⁢                              sin                ⁡                                  (                                                            ω                      2                                        ⁢                    t                                    )                                                      +                                          [                                                      (                                                                  ω                        2                                            -                                              ω                        1                                                              )                                    ⁢                                      (                                                                                            A                          1                          2                                                ⁢                                                  A                          2                                                                    4                                        )                                                  ]                            ⁢                              sin                ⁡                                  (                                                            2                      ⁢                                              ω                        1                                                              -                                          ω                      2                                                        )                                                      +                                          [                                                      (                                                                  ω                        1                                            -                                              ω                        2                                                              )                                    ⁢                                      (                                                                                            A                          1                                                ⁢                                                  A                          2                          2                                                                    4                                        )                                                  ]                            ⁢                              sin                ⁡                                  (                                                            2                      ⁢                                              ω                        2                                                              -                                          ω                      1                                                        )                                                      +                                                                                               [                                                                  -                                                  (                                                                                    ω                              1                                                        +                                                          ω                              2                                                                                )                                                                    ⁢                                              (                                                                                                            A                              1                              2                                                        ⁢                                                          A                              2                                                                                4                                                )                                                              ]                                    ⁢                                      sin                    ⁡                                          (                                                                        2                          ⁢                                                      ω                            1                                                                          +                                                  ω                          2                                                                    )                                                                      +                                                      [                                                                  -                                                  (                                                                                    ω                              1                                                        +                                                          ω                              2                                                                                )                                                                    ⁢                                              (                                                                                                            A                              1                                                        ⁢                                                          A                              2                              2                                                                                4                                                )                                                              ]                                    ⁢                  sin                  ⁢                                                                                                         (                                                                              2                            ⁢                                                          ω                              2                                                                                +                                                      ω                            1                                                                          )                                            +                                                                        [                                                      -                                                                                          ω                                1                                                            (                                                                                                A                                  1                                                                4                                                            )                                                                                ]                                                ⁢                                                  sin                          ⁡                                                      (                                                          3                              ⁢                                                              ω                                1                                                            ⁢                              t                                                        )                                                                                              +                                                                        [                                                      -                                                                                          ω                                2                                                            (                                                                                                A                                  2                                                                4                                                            )                                                                                ]                                                ⁢                                                  sin                          ⁡                                                      (                                                          3                              ⁢                                                              ω                                2                                                            ⁢                              t                                                        )                                                                                                                                                                                                      (        6        )            
Expression (6) represents the sine waves of specific amplitudes at eight different frequencies, corresponding to particular linear combinations of the two tones. With the amplitudes, frequencies, and phases all being predictable, it is possible to describe the behavior of IM.
Transducer nonlinearity is modeled herein as a polynomial. According to Taylor's theorem, any sufficiently smooth (i.e. differentiable) function can be approximated by polynomials. Such a polynomial form exists for most any nonlinearity expected to be encountered by the majority of flowmeter transducers. It has been observed that lower-order polynomial terms tend to dominate behavior for the flowmeter transducers described herein. Thus, for practical applications, an appropriate maximum polynomial order (e.g. 4th-8th) is preferable, though not mandatory.
This system nonlinearity may be modeled in terms of the input/output, or some number of derivatives or integrals of them. For instance, the voice coil transducers often employed by flowmeters measure velocity (considered to be the input/output space for the system), but are nonlinear according to position (the integral of velocity).
To handle IM distortion cases having any input frequencies, phases, and amplitudes, as well as any arbitrary nonlinearity polynomial, a few specific mathematical tools are briefly explained below in anticipation of their use in embodiments.
When expanding higher order terms of the polynomial, the input signal (or some derivative/integral of it) is raised to higher powers. Since embodiments are focused on multi-tonal signals, the input will be the sum of some number of terms. Thus, a closed-form expansion of the following expression is utilized:(x0+x1+x2+ . . . +xn)k  (7)
For large powers of k, or a large number of terms n, this can yield difficult calculations. However, this problem is a generalization of the more widely-known binomial expansion, (a+b)k. The binomial expansion produces k+1 terms, consisting of all combinations of powers of a and b that sum to k: ak, ak-1b, ak-2b2, . . . , abk-1, bk. The multinomial expansion then consists of all combinations of powers of x0, x1, . . . xn that sum to k. This multinomial expansion can be readily implemented using a recursive algorithm. Basically, the first term, x0, is looped through all allowed powers for it, from 0 to k. Then, for each allowed power of x0, looped through the allowed values of x1, from 0 to k minus the selected power for x0. Powers for subsequent terms are selected, terminating each path once the total power reaches k. Each valid combination of powers is noted in the full multinomial expansion array. Once all the loops have completed, every valid expansion term will have been computed.
The number of terms in the expansion can grow quite rapidly if either the power k or the number of terms n gets large. The problem is n-choose-k with replacement; that is, picking k items from a group of n, where a given item can be picked multiple times. The n-choose-k problem is a well-known construct in probability; thus, by simply consulting a reference, the number of terms produced by the multinomial expansion may be written as:
                              (                                                                      n                  +                  k                  -                  1                                                                                    k                                              )                =                                            (                              n                +                k                -                1                            )                        !                                                              (                                  n                  -                  1                                )                            !                        ⁢                          k              !                                                          (        8        )            
For example, without limitation, a five-term input raised to the fourth power will produce 70 terms, while a six-term input raised to the seventh power will produce 792 terms.
In addition to figuring out the terms present in a multinomial expansion, it is also necessary to compute the coefficients associated with this expansion. Returning to the binomial example:(a+b)2=a2+2ab+b2 (a+b)3=a3+3a2b+3ab2+b3 (a+b)4=a4+4a3b+6a2b2+4ab3+b4  (9)
The coefficients of the expansion follow a predictable pattern as the exponent increases—these coefficients are often referred to as Pascal's triangle. Individual coefficients are found using Pascal's rule:
                                          (                          a              +              b                        )                    2                =                              ∑                          k              =              0                        n                    ⁢                                    (                                                                    n                                                                                        k                                                              )                        ⁢                          a                              n                -                k                                      ⁢                          b              k                                                          (        10        )            
Again, there is fortunately a generalization of this formula to an arbitrary multinomial case. In the multinomial expansion, the coefficient associated with the term x0k0 x1k1 . . . xmkm is computed as:
                              n          !                                                    k              0                        !                    ⁢                                    k              1                        !                    ⁢                                          ⁢          ⋯          ⁢                                          ⁢                                    k              m                        !                                              (        11        )            
where, by the nature of the multinomial expansion, k0+k1+ . . . +km=n.
Multinomial expansion of sinusoid input tones will result in terms that are the product of a number of sines and cosines, for example:cos2ω1t·sin ω1t  (12)
To simplify and combine the results from various terms of the expansion, these need to be converted into independent sums of sines and cosines. This can be done by repeatedly applying the identities of expression (5), and by expressing the product as individual sines and cosines, and then repeatedly applying the identities:((cos ω1t·cos ω1t)sin ω1t)½((1+cos 2ω1t)sin ω1t)½(sin ω1t+½(sin 3ω1t−sin ω1t))  (13)
Additional terms result in a more complicated expansion, but follow the same fundamental rules. By the nature of the trigonometric identities used, the entire expansion will end up being represented as either sines or cosines. This repeated application of these identities ends up being relatively simple to implement in a loop, maintaining vectors of the frequencies and amplitudes produced. In general, each product doubles the number of terms in the reduced summation, but many of the terms end up being at the same frequency and hence combinable (e.g. the two sin ω1t terms in (13)), and even more so if one accounts for the equivalence of positive and negative frequencies:cos(−ωt)=cos(ωt)sin(−ωt)=−sin(ωt)  (14)
A flowmeter and/or associated electronics that can predict all the tones (including frequency, magnitude, and phase) produced by a system, given a polynomial model of system nonlinearity and a set of input tones to the system, is provided and an advance in the art is achieved. More particularly, transducers used in a flowmeter typically have significant variability in their strength—as much as 20-30% on notionally “identical” transducers. This variability is thought to be mostly due to variable magnet strengths, but can also result from differing engagement points of the at-rest transducer, due to variability in the manufacturing process. Additionally, transducer strength may vary due to field conditions, such as elevated temperature, for example. The apparatus and methods described herein provide a way to determine the transducer strength in real, physical units, based solely on electrical measurements. In this way, transducers can be calibrated based on measurements made with on-board flowmeter electronics rather than requiring specialized equipment. This also allows on-demand and/or periodic recalibration of fully assembled flowmeters.